const fs=require("fs");
const path=require("path");

let dirName=process.argv[2];
let filePath=path.join(__dirname,dirName)
function delDir(filePath){
    let statObj=fs.statSync(filePath)
    if(statObj.isFile()){
        fs.unlinkSync(filePath)
    }
    else if(statObj.isDirectory()){
        let childList=fs.readdirSync(filePath)
        for(let i=0;i<childList.length;i++){
            let childPath=path.join(filePath,childList[i])
            // let childObj=fs.statSync(childPath)
            // if(childObj.isFile()){
            //     fs.unlinkSync(childPath)
            // }else if(childObj.isDirectory()){
            //     delDir(childPath)
            // }
            delDir(childPath)
        }
        fs.rmdirSync(filePath)
    }
}
delDir(filePath)